
keep if G == "G3"

tab city, gen(ccity)
tab country, gen(ccountry)
destring appl_order, replace
tab appl_order, gen(aappl_order)
destring appl_type, replace
tab appl_type, gen(aappl_type)
tab gender, gen(ggender)


replace language_level = subinstr(language_level, "S", "", .)
destring language_level, replace
tab language_level, gen(llanguage_level)

gen group_numeric = subinstr(G, "G", "", .)
destring group_numeric, replace
tab group_numeric, gen(ggroup_numeric)

local occupations "mekaniker dataspecialist fordonsförare redovisningsekonom företagssäljare kock restaurangbiträde ekonomiassistent personaladministratör kontorsassistent lagerpersonal kundtjänstpersonal barnskötare personligassistent undersköterska butikssäljare lokalvårdare supporttekniker"  
foreach tmp_occ in `occupations' {
 gen occ_`tmp_occ' = occ == "`tmp_occ'"
}

drop high_edu

gen high_skill = 0
replace high_skill = 1 if occ == "dataspecialist" 
replace high_skill = 1 if occ == "företagssäljare" 
replace high_skill = 1 if occ == "redovisningsekonom" 
replace high_skill = 1 if occ == "supporttekniker" 

gen medium_skill = 0
replace medium_skill = 1 if occ == "ekonomiassistent" 
replace medium_skill = 1 if occ == "personaladministratör" 
replace medium_skill = 1 if occ == "barnskötare" 
replace medium_skill = 1 if occ == "fordonsförare" 
replace medium_skill = 1 if occ == "kock" 
replace medium_skill = 1 if occ == "mekaniker" 
replace medium_skill = 1 if occ == "kontorsassistent"
replace medium_skill = 1 if occ == "personligassistent" 

gen low_skill = 0
replace low_skill = 1 if occ == "butikssäljare" 
replace low_skill = 1 if occ == "lagerpersonal" 
replace low_skill = 1 if occ == "kundtjänstpersonal" 
replace low_skill = 1 if occ == "restaurangbiträde" 
replace low_skill = 1 if occ == "lokalvårdare" 

tab high_skill
tab medium_skill
tab low_skill

gen L4 = llanguage_level1
gen L3 = llanguage_level2
gen L2 = llanguage_level3
gen L1 = llanguage_level4
replace language_level = (-language_level) + 3 


gen L3L4 = 0
replace L3L4 = 1 if L3 == 1 | L4 ==1 
tab L3L4
